--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 401328fa1689a130a017dcc8d2cbadf438d9bb71
Parents : 4350a23
Author : Mark Qvist <mark@unsigned.io>
Date : 2025-11-01T18:27:11+01:00
Allow configuring max remote peering cost
Changes
3 files changed, 7 insertions(+), 6 deletions(-)
Diff
diff --git a/LXMF/LXMF.py b/LXMF/LXMF.py
index dbc0ab1..ede9c3a 100644
--- a/LXMF/LXMF.py
+++ b/LXMF/LXMF.py
@@ -173,7 +173,7 @@ def pn_announce_data_is_valid(data):
try:
if type(data) != bytes: return False
else: data = msgpack.unpackb(data)
- if len(data) < 7: raise ValueError("Invalid announce data: Insufficient peer data")
+ if len(data) < 7: raise ValueError("Invalid announce data: Insufficient peer data, likely from deprecated LXMF version")
else:
try: int(data[1])
except: raise ValueError("Invalid announce data: Could not decode timebase")
diff --git a/LXMF/LXMRouter.py b/LXMF/LXMRouter.py
index b1676f0..1d9cd5c 100644
--- a/LXMF/LXMRouter.py
+++ b/LXMF/LXMRouter.py
@@ -88,7 +88,7 @@ class LXMRouter:
enforce_ratchets=False, enforce_stamps=False, static_peers = [], max_peers=None,
from_static_only=False, sync_strategy=LXMPeer.STRATEGY_PERSISTENT,
propagation_cost=PROPAGATION_COST, propagation_cost_flexibility=PROPAGATION_COST_FLEX,
- peering_cost=PEERING_COST, name=None):
+ peering_cost=PEERING_COST, max_peering_cost=MAX_PEERING_COST, name=None):
random.seed(os.urandom(10))
@@ -134,7 +134,7 @@ class LXMRouter:
self.propagation_stamp_cost = propagation_cost
self.propagation_stamp_cost_flexibility = propagation_cost_flexibility
self.peering_cost = peering_cost
- self.max_peering_cost = LXMRouter.MAX_PEERING_COST
+ self.max_peering_cost = max_peering_cost
self.enforce_ratchets = enforce_ratchets
self._enforce_stamps = enforce_stamps
self.pending_deferred_stamps = {}
@@ -2420,7 +2420,6 @@ class LXMRouter:
else:
propagation_stamp = selected_lxm.get_propagation_stamp(target_cost=pn_target_cost)
- RNS.log(f"Generated propagation stamp: {RNS.hexrep(propagation_stamp)}")
if propagation_stamp:
selected_lxm.propagation_stamp = propagation_stamp
selected_lxm.defer_propagation_stamp = False
diff --git a/LXMF/Utilities/lxmd.py b/LXMF/Utilities/lxmd.py
index 5a8c9aa..59736db 100644
--- a/LXMF/Utilities/lxmd.py
+++ b/LXMF/Utilities/lxmd.py
@@ -377,6 +377,8 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo
propagation_limit = active_configuration["propagation_transfer_max_accepted_size"],
propagation_cost = active_configuration["propagation_stamp_cost_target"],
propagation_cost_flexibility = active_configuration["propagation_stamp_cost_flexibility"],
+ peering_cost = active_configuration["peering_cost"],
+ max_peering_cost = active_configuration["remote_peering_cost_max"],
sync_limit = active_configuration["propagation_sync_max_accepted_size"],
delivery_limit = active_configuration["delivery_transfer_max_accepted_size"],
max_peers = active_configuration["max_peers"],
@@ -1009,7 +1011,7 @@ autopeer_maxdepth = 4
# value required for a remote node to peer with
# and deliver messages to this node.
-# peering_cost = 10
+# peering_cost = 18
# You can configure the maximum peering cost
# of remote nodes that this node will peer with.
@@ -1019,7 +1021,7 @@ autopeer_maxdepth = 4
# more computation time during initial peering
# when generating the peering key.
-# remote_peering_cost_max = 12
+# remote_peering_cost_max = 24
# You can tell the LXMF message router to
# prioritise storage for one or more
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────